$(function () {
    obj.init();
});

var obj = new function () {
    'use strict';
    return {
        dataGrid: null,
        userId:null,
        sLogonName:null,
        form:null,
        params: {
        },
        init: function () {
            this.userId = xhTool.getQuery('userIds');
            this.form = new xhForm($('#xh_form'));

            this.listener();
        },
        listener: function () {
            var $this = this;
            $('#iSchoolId').select2();
            //提交按钮
            $('#bt_modal_confirm',parent.document).click(function () {
                $this.funObj().submit();
            });
        },
        funObj: function () {
            var $this = this;
            return {
                submit: function () {
                    var sLogonName = $('#sLogonName').val();
                    if(sLogonName == "" || sLogonName == null){
                        window.top.xhTop.showError('登录名必填');
                        xhExtra.setBtnNormal($('#bt_modal_confirm',parent.document));
                        return false;
                    }
                    $this.form.submit('User/modifyUser', {}, function (data) {
                        if(data.code!=200){
                            window.top.xhTop.showError(data.error);
                            xhExtra.setBtnNormal($('#bt_modal_confirm',parent.document));
                            return false;
                        }
                        window.top.xhTop.showSuccess(data.msg);
                        window.top.xhTop.closeModal();
                        xhExtra.backToList($this.dataGrid);
                    },{check:false});
                }
            }
        }
    }
};